package com.fanshuai.lifecycle.aware;

import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;

/**
 * 获取全局Resource
 */
@Component
public class DemoResourceLoader implements ResourceLoaderAware {
    private ResourceLoader resourceLoader;

    @Override
    public void setResourceLoader(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
        System.out.println("resource loader=" + resourceLoader);
    }

    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }
}
